package com.ftg.examsys.util;

/**
 * 构建者
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/9/13 下午1:15
 */
public class ResBuilder {

    /**
     * 操作成功了
     * @param data 最终返回的数据
     * @return
     * @param <E>
     */
    public static <E> ResUtil<E> ok(E data){
        ResUtil<E> resUtil = new ResUtil<>();
        resUtil.setCode(200);
        resUtil.setMess(ConstMess.SUCCESS_TIP_MESS);
        resUtil.setData(data);
        return resUtil;
    }

    /**
     * 操作失败了
     * @return
     * @param <E>
     */
    public static <E> ResUtil<E> failure(){
        ResUtil<E> resUtil = new ResUtil<>();
        resUtil.setCode(500);
        resUtil.setMess(ConstMess.FAILURE_TIP_MESS);
        return resUtil;
    }

}
